Skip to content

Merge changes from upstream incl. data layer - #363

Merged
tgilon merged 68 commits into
masterfrom
merge-upstream-260109
Jan 23, 2026
Merged

Merge changes from upstream incl. data layer#363
tgilon merged 68 commits into
masterfrom
merge-upstream-260109

Conversation

@tgilon

@tgilon tgilon commented Jan 9, 2026

Copy link
Copy Markdown
Member

Closes #306, last stage of open-energy-transition#83 and #359.
Do not merge before v0.4.2-alpha is released

Changes proposed in this Pull Request

This PR brings in upstream changes merged into OET's pypsa-eur fork via open-energy-transition#83. Merge conflicts:

  • .github/pull_request_template.md
  • .github/workflows/test.yaml
  • README.md
  • config/plotting.default.yaml
  • doc/conf.py
  • doc/configtables/costs.csv
  • doc/configtables/electricity.csv
  • doc/configtables/plotting.csv
  • doc/data-bundle.rst
  • doc/data-retrieval.rst
  • doc/data_sources.rst
  • doc/release_notes.rst
  • doc/retrieve.rst
  • pixi.lock
  • rules/build_electricity.smk
  • rules/common.smk
  • rules/retrieve.smk
  • rules/solve_myopic.smk
  • scripts/_helpers.py
  • scripts/plot_balance_map.py
  • scripts/solve_network.py
  • scripts/solve_operations_network.py

In addition to solving merge conflicts, the following changes were made:

  • updated renormalized line endings (as in chore: renormalize line endings to enforce .gitattributes #362)
  • adopted the new way of defining copyright owners in doc/conf.py, i.e.: "PyPSA-Eur and Open-TYNDP Contributors"
  • made all the changes required to integrate the Open-TYNDP specific data into the data layer
  • deprecated the retrieve_additional_tyndp_data rule
  • updated the documentation to integrate Open-TYNDP specificities. Note that doc/tyndp-2024-bundle.rst was kept. This deviates slightly from the data layer documentation structure. However, it is important to make this explicit.
  • contributed some fixes upstream chore: fix formatting and improve consistency in data layer doc PyPSA/pypsa-eur#1977
  • reworked the PECD pre-built process to be compatible with the data layer
  • manually update the lockfile to integrate powerplantmatching >= 0.8.0

To review the PR, I suggest focusing on two things:

  • review the conflict resolution up to 4cd7cdc
  • review the data layer integration starting from there

Tasks

  • Integrate TYNDP-specific data sources in the data layer
  • Decide how to integrate TYNDP data in doc/data_sources.rst
  • Remove doc/data_retrieval.rst once the integration is complete (it was kept during the merge process to keep track of the information)
  • Make sure that doc/retrieve.rst reflects only existing rules
  • Update REUSE.toml
  • Fix PECD pre-built release process

Checklist

  • I tested my contribution locally and it works as intended.
  • Code and workflow changes are sufficiently documented.
  • Changed dependencies are added to pixi.toml (using pixi add <dependency-name>).
  • Changes in configuration options are added in config/config.default.yaml.
  • Changes in configuration options are documented in doc/configtables/*.csv.
  • Changes in configuration options are added in config/test/*.yaml.
  • Open-TYNDP SPDX license header added to all touched files.
  • Sources of newly added data are documented in doc/data_sources.rst.
  • New rules are documented in the appropriate doc/*.rst files.
  • A release note doc/release_notes.rst is added.
  • Major features are documented with up-to-date information in README and doc/index.rst.
  • Module docstrings added to new Python scripts.

euronion and others added 27 commits December 2, 2025 17:13
* code: Versioning for hotmaps dataset

* code: Fix CLI not working for foreign owned records

* code: versioning for co2stop dataset

* code: versioning for nitrogen statistics datset

* code: fix wrong file name for REUSE.toml

* code: versioning for NUTS 2013 and NUTS 2021

* code: Add limited debug mode for CLI script

* code: Fix issues with datasets not being detected

* code: Fix minor bugs on CLI and outputs

* code: Versioning for eurostat energy balances

* code: Remove obsolete retrieve script, now part of retrieve.smk

* code: Versioning for eurostat household energy balances

* code: Fix missing replacements for eurostat energy balances

* code: Remove prompt for API key

* code: Fix typo for enspreso biomass dataset

* code: Fix issue with OSM dataset versioning

* code: Versioning for WDPA and WDPA marine

* code: Implement versioning for TYNDP base network

* code: Fix bug missing osm_version in base_network.py

* code: Properly fix the bug this time

* code: Implement versioning for powerplants / powerplantsmatching

* code/docs: Implement versioning for costs

* code: Implement versioning for cutouts, move to data/ , deprecate shared_cutouts

* Fix: Wrong URL for powerplants

* code: Implement versioning for HDD and runoff per country (retrieval only)

* code: Add build options for HDD and runoff per country (untested)

* code: Add option for monthly retrieval of cutouts while building

* code: Restore build_natura_raster.py script

* code: Implement versioning for natura raster + reintegrate build natura raster script

* data: Change URB POP dataset to Zenodo link

* code: Adjust link for GEM GSPT

* code: Versioning for GEM Europe Gas Tracker

* doc: Correct license attributions in REUSE.toml for data/

* code: Implement versioning for BFS vehicle data

* code: Implement versioning for BFS GDP and POP data

* doc: Update data_inventory.csv for all the datasets added

* code: Fix versions for HDD and runoff per country

* code: Fix rules for creating HDD and runoff per country

* code: Add special cutout config for HDD/runoff

* code: Fix monthly_requests for cutouts

* code: Add logic for building and versioning of mobility profiles from BASt

* data: Update data for mobility profiles from BASt

* code: Windows compatability for cutouts

* code: Deprecate automatic cutout bounds

* pre-commit formatting

* code: Remove cutout dir configuration option

* code: Fix option for archived mobility_profiles

* code: Cleanup unused stub

* config: Remove deprecated config option from configfiles

* code: Remove prompt for API key

* LUISA land cover database - data versioning

* JRC-IDEES dataset versioning implementation

* Remove obsolete script for retrieving jrc idees data

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Scigrid gas network - versioning implementation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* doc: scigrid dataset updates to versions.csv

* Synthetic electricity demand versioning

* Copernicus Global land service versioning

* changing not-supported to might-work flags for some datasets

* Ship raster - versioning implementation

* EEZ dataset versioning implementation

* NUTS3 population dataset versioning

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* GDP per capita dataset versioning

* WorldPop population count dataset versioning

* EEA ghg emissions data versioning

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* GEBCO versioning

* Attributed Ports data versioning

* Updating URLs

* CORINE dataset versioning

* Emobility dataset versioning

* Common function to unzip folders

* H2 salt caverns data versioning

* Update primary link for GHG emissions

* Primary link update for population count dataset

* Lau regions data versioning

* Data versioning for Aquifer data BGR

* Updating archive link for lau regions

* Retrieving corine dataset from primary datasource

* OSM boundaries primary data versioning

* OSM boundaries archive link update

* rename function

* code: Fix enspreso_biomass dataset name

* code: Improve WDPA dataset handling

* code: Simplify zip file handling

* code: Simplify eurostat balances access

* code: Centrally configure http storage provider

* code: Fix typo

* code: Enable config of prepare_kwargs

* Bug fix - remove duplicate input entries for rule build_shapes

* Removing check for retrieve flag

* Moving corine Apikey from file to config parameter

* Polishing the code

* Code polishing for aquifer data set

* code: Remove unnecessary code

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* code: simplify worldbank retrieval rule

* change indexing method for rules

* Remove code block for retrieving databundle

* modifying the way to unzip folders

* Code modifications

* doc updates

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Script license

* License correction

* Doc formatting

* code: Cleanup GEBCO retrieval

* code: Always copy storage(...) retrieved data, manage keep_local centrally

* code: remove params from retrieve_jrc_idees

* code: remove params from retrieve_gas_infrastructure

* code: remove params for retrieve_eez

* code: Remove params for retrieve_osm_boundaries

* code: Deprecate enable::retrieve, enable::retrieve_databundle, enable::retrieve_cost_data

* code: addendum to centrally managing `keep_local` setting for storage(...)

* code: formatting

* doc: Update configtables for data:: config options

* code: Cleanup old comments

* doc: remove duplicate dataset

* doc: Clarify `url` entry in data/versions.csv

* Code cleanup

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Adding comments

* Versioning for dh_areas

* Data versioning for geothermal heat utilisation potentials

* Update links for archive versions of dh_areas and geothermal heat utilisation potentials

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* doc: Configuration entries for dh_areas and geothermal_heat_utilisation_potentials

* code: Remove obsolete databundle retrieval

* doc: Update retrieve.rst

* doc: Remove outdated information and sites

* doc: Update PR template with hint to instruction on data versioning

* code: Fix config["enable"]["retrieve"] artifacts

* code: Update paths for accessing retrieved gas network

* code: Remove obsolete script

* code: Remove validate_checksum as it keeps failing from too many requests

* code: Fix links for web archive versions

* doc: Update formatting

* doc: try different table formatting

* code: Increase retries on retrieve

* code: Fix in biomass potentials

* code: Modify code to reference variable instead of index

* code: Bug fix

* code: correction to PyPSA set_option

* remove conda in snakemake rule

* code: Set max_requests_per_second

* code: Adding versioning for JRC Ardeco dataset

* code: JRC Ardeco URL updates

* code: plot balance map bug fix

* Update pypsa version to 0.33.2

* code: Cleanup ARDECO retrieval

* code: Fix ARDECO retrieval rules

* code: Adjust http storage limits to avoid Zenodo rate limit

* debug: Extract information about Zenodo cert

* Switch to primary sources for BFS data to avoid web archive retry limits

* code: See if we can extract the Zenodo rate limit

* code: Only request head

* code: Align retrieve_corine with rest of code

* code: Remove superflous parts

* code: Add modified snakemake storage plugin

* code: Fix typo

* wip

* WIP stuff

* code: Bugfix workflow

* nuclear approach to rate limiting errors

* code: Fix EEZ retrieval from archive

* feat: Add snakemake storage plugin for downloading zenodo files

with ratelimit backoff, concurrent downloading and progress bars.

* Update retrieve.smk to rely on zenodo storage plugin

* Make pre-commit happy

* fix url substring sanitization

* Use tqdm-loggable to avoid flooding github logs

* Add retries option to zenodo storage provider

* fix: merge conflict to accomodate new rule build_dh_areas

* fix lau_regions zenodo url

* Re-add zenodo checksums (retrieved from api) and pull retrying into storage plugin

* Replace aiohttp with httpx

better connection pooling and timeout handling.

* Release the stream a tiny bit earlier

* fix: do cache data_versions

for lru_cache to work the method needs to be at the toplevel.

* Allow deactivating the cache and skipping all remote checks

Use these settings for ci, since we already cache the resulting data folder.

* Derive from settings from SettingsBase and clean up some docs

* Revert "debug: Extract information about Zenodo cert"

This reverts commit c1edb28.

* fix: address unfounded fears

* improve docstrings

* feat: improve checksumming by allowing any digest

* Update README.md

* Expand user in `cache` directory

* fix: missed fixes

* cleanup

* refactor: move storage plugin to own repo

* refactor: rename `version_latest` to `version`

* feat: allow passing corine secret via envvar

* refactor: move zenodo cli to dedicated `utils` dir

* Skip storage plugin cache in CI

* feat: extract aquifer_data onaccess

saves space.

* fix: use vsizip to transparently decompress nuts3 2021

* fix: save synthetic electricity demand as csv.gz

* fix: clean conda caches after update

* Revert "fix: save synthetic electricity demand as csv.gz"

This reverts commit 0ebc02c.

* Revert "fix: use vsizip to transparently decompress nuts3 2021"

This reverts commit 9e6cd7f.

* Revert "feat: extract aquifer_data onaccess"

This reverts commit 6de88a2.

* remove tenacity and old checksum/ internet helpers

* Adjust file paths to work on Windows

Minor changes:
- set paths to always use posix format

* Fix file paths on windows nicely (#71)

* fix: use string paths with / even on windows

* feat: Add pixi toml and lock

* fix: fix retrieve_worldbank_urban_population

* Update rules/build_sector.smk

* Revert "feat: Add pixi toml and lock"

This reverts commit 9c9bf97.

* code: Remove quotation marks in config

* Update comment

* Update storage plugin config

* code: Update pixi dependencies

* code: Fix wildcard

* Update rules/build_electricity.smk

Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>

* Update doc/release_notes.rst

Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>

* update `pixi.lock`

* remove snakemake-storage-plugin-cached-http install from pypi

* Revert "update `pixi.lock`"

This reverts commit 6cecd76.

* revert updated lock file

* fix pre-commit

---------

Co-authored-by: Sermisha <sermisha.narayana@openenergytransition.org>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Sermisha <156903227+SermishaNarayana@users.noreply.github.com>
Co-authored-by: Lukas Trippe <lkstrp@pm.me>
Co-authored-by: Jonas Hoersch <jonas.hoersch@openenergytransition.org>
Co-authored-by: Jonas Hörsch <coroa@posteo.de>
Co-authored-by: Eric Nitschke <eric.nitschke@tuhh.de>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
* Fix BFS Swiss transport parsing

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add release notes

---------

Co-authored-by: Danele Lerede <danelelerede@Martins-MacBook-Air.local>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
)

* added existing biomass decentral and rural heating

* added release notes

* fixed typo

* fixed typo in definitions

* fixed pre-commit
* Fix 2.0 build_energy_totals for CH.

* Updated release notes.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Set mock_snakemake to rule defaults.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Bumps the github-actions group with 1 update: [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request).


Updates `peter-evans/create-pull-request` from 7 to 8
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](peter-evans/create-pull-request@v7...v8)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* ci: run model runs only with src changes

* add data
Updated warning and note sections for clarity and consistency.
…up (PyPSA#1945)

Bumps the github-actions group with 1 update: [actions/cache](https://github.com/actions/cache).


Updates `actions/cache` from 4 to 5
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps the github-actions group with 2 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact) and [actions/download-artifact](https://github.com/actions/download-artifact).


Updates `actions/upload-artifact` from 5 to 6
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v5...v6)

Updates `actions/download-artifact` from 6 to 7
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/download-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…nd solving) (PyPSA#1902)

* refac: separate problem prep and solving

* feat: add configs for rolling horizon and iterative cases of small BE model instance

* move new rh and iterative configs to examples/

* docs: patch release notes

* fix: enable brownfield + rh mode

* refac: implement all feedback

* remove RH configs

---------

Co-authored-by: Lukas Trippe <lkstrp@pm.me>
* Fixes for network building from overpass (formerly osm-raw).

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Updated config.default and toplevel.csv configtable.

* Cleaned up getters in retrieve_osm_data.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Updated release notes.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
Co-authored-by: lkstrp <62255395+lkstrp@users.noreply.github.com>
* Renamed original static plotting to '_static' and changed all map outputs to 'RESULTS + maps/static/...'. Maps in resources are not touched.

* Fix: Updated config_providers to read updated config key 'balance_map_static.'

* Interactive map implementation and static map plotting refactoring.

* removed H2 vmin and vmax.

* Dropped enable toggle.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* removed test config.

* Restore build_energy_totals from master

* Reverted to old plotting keys for balance_maps and changed balance_map_static back to balance_map

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Reordered plotting.default.yaml and added configtables for interactive maps.

* Added release notes.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fabian Neumann <fabian.neumann@outlook.de>
…1955)

* fix: compatibility of build_gas_* rules with pyogrio >=0.12.0

pyogrio >=0.12.0 returns JSON fields directly as dicts/lists, so that loading them again
as json fails.

refer to https://github.com/geopandas/pyogrio/releases/tag/v0.12.0 .

* Update release_notes.rst
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.13.3 → v0.14.10](astral-sh/ruff-pre-commit@v0.13.3...v0.14.10)
- [github.com/fsfe/reuse-tool: v6.0.0 → v6.2.0](fsfe/reuse-tool@v6.0.0...v6.2.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix: types

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: lkstrp <lkstrp@pm.me>
 Conflicts:
	.github/pull_request_template.md
	REUSE.toml
 Conflicts:
	.github/pull_request_template.md
 Conflicts:
	.github/pull_request_template.md
	.github/workflows/test.yaml
	README.md
	config/plotting.default.yaml
	doc/conf.py
	doc/configtables/costs.csv
	doc/configtables/electricity.csv
	doc/configtables/plotting.csv
	doc/data-bundle.rst
	doc/data-retrieval.rst
	doc/data_sources.rst
	doc/release_notes.rst
	doc/retrieve.rst
	pixi.lock
	rules/build_electricity.smk
	rules/common.smk
	rules/retrieve.smk
	rules/solve_myopic.smk
	scripts/_helpers.py
	scripts/plot_balance_map.py
	scripts/solve_network.py
	scripts/solve_operations_network.py
@tgilon tgilon added this to the Release v0.5 milestone Jan 9, 2026
@tgilon tgilon self-assigned this Jan 9, 2026
@tgilon tgilon added the DNMY Do Not Merge Yet label Jan 9, 2026

@daniel-rdt daniel-rdt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @tgilon. You did a very good job in merging these complicated changes from upstream. Super thorough! I tested different workflows and the new data layer is really nice.

I still have a couple of comments that need addressing before we can merge the PR. But it shouldn't take long. The main points are:

  • Needed: Fix needed for the two conflicting retrieve_tyndp rules, to make the upstream version work again with the dedicated Zenodo record
  • Would be better: Add a configuration option to configure how to increment the PECD pre-built version
  • Optional: dataset_version could be slightly refactored to decrease diff to upstream

Also, we could consider updating the lock files again manually before merging to replace the scheduled lock file update on master also for this week.

Comment thread rules/retrieve.smk
Comment thread data/versions.csv Outdated
Comment thread config/config.default.yaml
Comment thread doc/data_inventory.csv Outdated
Comment thread rules/retrieve.smk Outdated
Comment thread rules/retrieve.smk
Comment thread rules/common.smk Outdated
Comment thread rules/sb.smk
Comment thread doc/data_inventory.csv
Comment thread doc/configtables/electricity.csv Outdated
@tgilon tgilon added SB Scenario Building CBA Cost Benefit Analysis labels Jan 21, 2026

@tgilon tgilon left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @daniel-rdt for the review. I have applied most of your suggestions. I had already updated the lock file, but I did so again just to be sure. Let me know if you have any further comments.

Comment thread doc/configtables/electricity.csv Outdated
Comment thread rules/retrieve.smk
Comment thread rules/retrieve.smk
Comment thread doc/data_inventory.csv
Comment thread rules/sb.smk
Comment thread rules/common.smk Outdated
@tgilon
tgilon requested a review from daniel-rdt January 21, 2026 16:10

@daniel-rdt daniel-rdt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now. Thank you @tgilon. Once the CI passes, we can merge this PR 🎉

Comment thread rules/sb.smk
@tgilon
tgilon merged commit 0a5e64c into master Jan 23, 2026
5 checks passed
@tgilon
tgilon deleted the merge-upstream-260109 branch January 23, 2026 08:12
tgilon added a commit that referenced this pull request Jan 23, 2026
tgilon added a commit that referenced this pull request Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CBA Cost Benefit Analysis SB Scenario Building

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merge upstream data layer feature